package com.example.simple_android.Manager.impl;

import com.example.simple_android.Manager.AbstractManager;
import com.example.simple_android.annotation.InjectionMark;

import java.util.HashMap;

@InjectionMark(staticMethod = "getInstance")
public class InjectionManager extends AbstractManager<String, Object> {

    /**
     * 此变量存放着全局唯一的InjectionManager对象
     */
    private static InjectionManager injectionManager = new InjectionManager();

    /**
     * 私有构造方法，禁止其他类私自创建此类对象
     */
    private InjectionManager() {
        map = new HashMap<>();
    }

    /**
     * 调用此方法，获取全局唯一的InjectionManager对象
     *
     * @return 全局唯一的InjectionManager对象
     */
    public static InjectionManager getInstance() {
        if (injectionManager == null) {
            injectionManager = new InjectionManager();
        }
        return injectionManager;
    }
}
